/**
 * RunPeriod.java - 2012-3-2
 *
 * Licensed Property to China UnionPay Co., Ltd.
 * 
 * (C) Copyright of China UnionPay Co., Ltd. 2010
 *     All Rights Reserved.
 *
 * Project Info: China UnionPay Internet Acquiring Project
 * 
 * Modification History:
 * =============================================================================
 *   Author         Date          Description
 *   ------------ ---------- ---------------------------------------------------
 *        
 * =============================================================================
 */
package com.lijin.batchsys.framework.schedule;

/**
 * Description: 任务运行周期枚举类
 *
 * (C) Copyright of China UnionPay Co., Ltd. 2010.
 *
 */
public enum RunPeriod {

	DAILY("00", "每日运行"),
	WEEKLY("10", "每周运行"),
	MONTHLY("20", "每月运行"),
	SEASONLY("30", "每季度执行"),
	HALF_YEARLY("40", "每半年执行"),
	YEARLY("50", "每年执行");

	private String typeCode; // 运行周期类型码
	private String desc; // 描述
	
	private RunPeriod(String typeCode, String desc) {
		this.typeCode = typeCode;
		this.desc = desc;
	}
	
	/**
	 * 根据类型码获取运行周期枚举类
	 * @param typeCode
	 * @return
	 */
	public static RunPeriod parseByType(String typeCode) {
		for (RunPeriod rp : RunPeriod.values()) {
			if (rp.getTypeCode().equals(typeCode)) {
				return rp;
			}
		}
		throw new IllegalArgumentException("未找到对应的枚举类【typeCode=" + typeCode + "】");
	}

	public String getDesc() {
		return desc;
	}

	public String getTypeCode() {
		return typeCode;
	}

}
